package com.pureut.storage.utils;

/*** 
 * 生成方式枚举
 * Author:C
 * Date:2022/12/23 15:51
 * @DESC
 */
public enum GenerationMethodEnum {


    AUTO_GENERATE(1, "自动生成"),
    MANUALLY_GENERATED(2, "手动生成");

    private final int code;
    private final String value;


    GenerationMethodEnum(int code, String value) {
        this.code = code;
        this.value = value;
    }

    /**
     * 获取 code
     */
    public int getCode() {
        return this.code;
    }

    /**
     * 获取 value
     */
    public String getValue() {
        return this.value;
    }

    /**
     * 获取变量名列表
     */
    public static GenerationMethodEnum[] getVariables() {
        return values();
    }

    /**
     * 根据code获取value
     */
    public static String getValue(int code) {
        for (GenerationMethodEnum myEnums : values()) {
            if (code == myEnums.code) {
                return myEnums.value;
            }
        }
        return "";
    }
}
